Sending Messages
Sending Messages API
The API for sending messages to groups and individuals
If you are a go language developer ,to download the "sendmessage" SDK below:
Go-sdk download address: https://github.com/debox-pro/debox-chat-go-sdk
Gethttps://open.debox.pro/openapi/send_robot_group_message
Send text messages to groups
Call example:
curl -X POST -H "Content-Type: application/json" -H "X-API-KEY: t2X........AlEF6" -d '{"to_user_id":"uvg2p6ho","group_id":"fxi3hqo5","object_name":"RC:TxtMsg","message":"i am message sent by bot"}' "https://open.debox.pro/openapi/send_robot_group_message"
Call example:
curl -X POST -H "Content-Type: application/json" -H "X-API-KEY: t2X........AlEF6" -d '{"to_user_id":"uvg2p6ho","group_id":"fxi3hqo5","object_name":"RC:TxtMsg","message":"i am message sent by bot"}' "https://open.debox.pro/openapi/send_robot_group_message"
Parameters
Query
group_id
: String
Group ID of a group. Indicates the group to which the message is sent, not empty
to_user_id
: String
User ID of the user. Indicates the user of the @ who. The value can be blank
object_name
: String
Indicates the message type. must be "RC:TxtMsg"
message
: String
Literal message string, non-empty
Header
X-API-KEY
: String
App Key, apply on platform https://developer.debox.pro/
Responses
200: OK
{
"code":200,
"data":null,
"message":"success",
"success":false
}
Gethttps://open.debox.pro/openapi/send_robot_group_message
Rich text,suport text and image.
content contains texts and images
Example:
curl -X POST -H "Content-Type: application/json" -H "X-API-KEY: t2XJ........lEF6" -d '{"group_id":"l3ixp32y","object_name":"RCD:Graphic","title":"i am title","content":"i am rich text {\"uitag\":\"a\",\"text\":\"click me\",\"href\":\"https://debox.pro/\"}jump to"}' "https://open.debox.pro/openapi/send_robot_group_message"
content contains texts and images
Example:
curl -X POST -H "Content-Type: application/json" -H "X-API-KEY: t2XJ........lEF6" -d '{"group_id":"l3ixp32y","object_name":"RCD:Graphic","title":"i am title","content":"i am rich text {\"uitag\":\"a\",\"text\":\"click me\",\"href\":\"https://debox.pro/\"}jump to"}' "https://open.debox.pro/openapi/send_robot_group_message"
Parameters
Query
group_id
: String
Group ID of a group. Indicates the group to which the message is sent, not empty
to_user_id
: String
User ID of the user. Indicates the user of the @ who. The value can be blank
object_name
: String
The message type. must be RCD:Graphic
title
: String
The title of the message
content
: String
The main part of the richtext message, which can insert hyperlinks and pictures
Header
X-API-KEY
: String
Api key, apply on platform https://developer.debox.pro/
1、Hyperlink
Example: {"uitag":"a","text":"USDC","href":"https://debox.pro/deswap"}
Convert the following JSON into string and put it in Content. In the Debox APP, a hyperlink will be displayed
var uiA = {
uitag: "a",
text: text,
href: href,
}
"uitag"="a", Indicates a hyperlink.
text, The hyperlink text
href, The website address of the hyperlink
2、Image
Example:{"uitag":"img","src":"https://domain.com/a.png","position":"foot","height":"500","href":""}
Convert the following JSON into string and put it in Content. In the Debox APP, a image hyperlink will be displayed
var uiImg = {
uitag: "img",
src: "<https://domain.com/a.png>",
position: "foot",
href: "<https://debox.pro>",
height: "500",
}
uitag="img" ,Indicates that it is a text image hyperlink
src:The image resource address
position:The position of the image,values are as follows:
head,It means that the picture is displayed at the top, in front of the title
foot,Indicates that the picture is displayed at the bottom
For other values, hide the picture without displaying anything
href,The hyperlink address of the image
When the white list address for DEBOX, open it directly
When a non -white address, the bomb prompt warning box
When it is empty, or if there is no definition, display the enlarged picture
height: image height, values are as follows:
height> =0 ,image height is set to the value of height,
height<0、When the number is not configured or configured, the default value is used. The high default value of iOS, Android top picture is 115; the high default value of the bottom picture is 230
height=0, display nothing
3、A sample of the content:
coinName Price \n
{"uitag":"a","text":"USDT","href":"https://debox.pro/deswap"} 96.78k
{"uitag":"a","text":"USDC","href":"https://debox.pro/deswap"} 81.74k
{"uitag":"a","text":"OP_ETH","href":"https://debox.pro/deswap"} 2.55k
{"uitag":"a","text":"BNB","href":"https://debox.pro/deswap"} 3.95
{"uitag":"img","src":"https://domain.com/a.png","position":"head","height":”300”,"href":"https://www..."}
{"uitag":"img","src":"https://domain.com/b.png","position":"foot","height":"500","href":"https://www..."}
Display as follows:
pure text:
image top,text bottom
text top, image bottom:
image top, text middle, image bottom :
Responses
200: OK
{
"code":200,
"data":null,
"message":"success",
"success":false
}
Gethttps://open.debox.pro/openapi/send_robot_message
Send message to some user
Call example:
curl -X POST -H "Content-Type: application/json" -H "X-API-KEY: t2X........AlEF6" -d '{"to_user_id":"uvg2p6ho","object_name":"RCD:Command","message":"i am a message to user from bot"}' "https://open.debox.pro/openapi/send_robot_message"
Call example:
curl -X POST -H "Content-Type: application/json" -H "X-API-KEY: t2X........AlEF6" -d '{"to_user_id":"uvg2p6ho","object_name":"RCD:Command","message":"i am a message to user from bot"}' "https://open.debox.pro/openapi/send_robot_message"
Parameters
Query
to_user_id
: String
Userid of the user. Indicates the recipient of the message. The value is not empty
object_name
: String
Private message ,must be RCD:Command
message
: String
The message content
Header
X-API-KEY
: String
App Key, apply on platform https://developer.debox.pro/
Responses
200: OK
{
"code":200,
"data":null,
"message":"success",
"success":false
}